/**
 * 生成验证码的action
 */
package com.jeedroid.verifyNumAction;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Random;

import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
public class GenerateVerfyCode extends ActionSupport
{
private ByteArrayInputStream inputStream;
	@Override
	public String execute() throws Exception
	{
		RandomNumUtil ran=RandomNumUtil.instance();
		this.setInputStream(ran.getImage()); //取得带有随机字符串的验证码图片
		ActionContext.getContext().getSession().put("verifycode", ran.getStr());
		return SUCCESS;
	}

	public ByteArrayInputStream getInputStream()
	{
		return inputStream;
	}
	public void setInputStream(ByteArrayInputStream inputStream)
	{
		this.inputStream = inputStream;
	}
	
}
